import 'package:flutter/material.dart';

import '../../../utils/Tools.dart';

class StarTextWidget extends StatelessWidget {
  final String text;
  final double borderRadius;
  final Color borderColor;
  final Color starColor;
  final double starSize;
  final TextStyle textStyle;

  const StarTextWidget({
    super.key,
    required this.text,
    this.borderRadius = 5.0,
    this.borderColor = Colors.grey,
    this.starColor = Colors.orange,
    this.starSize = 16.0,
    this.textStyle = const TextStyle(fontSize: 12, color: Colors.black),
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        border: Border.all(color: borderColor, width: 1.0), // 设置边框
        borderRadius: BorderRadius.circular(borderRadius), // 设置圆角
      ),
      child: Row(
        mainAxisSize: MainAxisSize.min, // 根据内容大小调整
        children: [
          Stack(
            children: [
              Container(
                width: 22,
                height: 20,
                decoration: BoxDecoration(
                  color: Tools.fromHex('#e9513a'),
                  borderRadius: const BorderRadius.only(
                    topLeft: Radius.circular(4),
                    bottomLeft: Radius.circular(4),
                    topRight: Radius.circular(8),
                    bottomRight: Radius.circular(8),
                  ), // 设置圆角
                ),
              ),
              Padding(
                padding: const EdgeInsets.symmetric(vertical: 2, horizontal: 2),
                child: Image.asset(
                  'assets/images/fen_xiang_star.png', // 空心五角星
                  color: Colors.white,
                  height: starSize,
                  width: starSize,
                ),
              ),
            ],
          ),
          const SizedBox(width: 5), // 星星和文字之间的间距
          Text(
            text,
            style: textStyle,
          ),
          const SizedBox(width: 5), // 星星和文字之间的间距
        ],
      ),
    );
  }
}
